Apache web server¶
Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.
The Apache Web Server (Apache HTTP Server) is an open-source, cross-platform web server software developed and maintained by the Apache Software Foundation. It is known for its stability, security, and high scalability, and supports a wide range of features through rich modules. It is one of the most widely used web servers in the world, commonly used for website hosting, dynamic application support, and reverse proxy scenarios.
This document describes how to install and run the Apache Web Server on the Quectel Pi M2 Debian system and access the web page from a Windows computer on the same local area network.
Prerequisites¶
Confirm the device environment:
The Quectel Pi M2 and Windows host are on the same local area network with working network connectivity between both sides
If you plan to install Apache online via
apt, the device must also be able to access Debian software repositories
Check network connectivity:
Run
hostname -Iin the device terminal to view the current IP address, thenpingthe Windows host or gateway address on the same network segment; if you see returned time information, LAN communication is working normally. You can also runping <board-IP>on the Windows host to confirm.
Log in to the development board:
You can log in via serial console or graphical interface; the default user is
q.
Install Apache Web Service¶
Apache is one of the most commonly used web server programs for providing website access services.
Update the software repositories:
sudo apt update
Install the Apache service:
sudo apt install apache2 -y
💡 If the current network cannot access Debian software repositories, you can also download the
apache2,apache2-data,apache2-utilsand other architecture-matching packages on the host first, then copy them to the device for offline installation.
Confirm that Apache is installed successfully:
/usr/sbin/apache2 -v
Start and Enable Autostart¶
Start the Apache service:
sudo systemctl start apache2
Set it to start automatically on boot:
sudo systemctl enable apache2
Check the running status:
sudo systemctl status apache2
systemctl is-active apache2
systemctl is-enabled apache2
Allow the Web Access Port¶
If the device firewall has restricted port 80, you need to add a rule to allow it. The following example allows a specific Windows host to access the device’s HTTP service. Replace <Windows-host-IP> with the actual IP:
sudo iptables -I INPUT 1 -i eth0 -p tcp -s <Windows-host-IP> --dport 80 -j ACCEPT
Check port listening and firewall rules:
ss -tulnp | grep ':80'
sudo iptables -S INPUT | grep 80
Testing confirms that Apache is listening on 0.0.0.0:80 or :::80. For actual access, use the device’s current IP address obtained from hostname -I.
View the Device IP Address¶
hostname -I
Test Apache Installation¶
Access the following URL in a browser on a computer within the same local area network:
http://<board-IP>/
If everything is working normally, you will see the Apache default page.
Change the Default Web Page¶
The default web page of Apache is an HTML file in the file system, located at /var/www/html/index.html.
Navigate to this directory and view the contents:
cd /var/www/html
ls -al
The following content will be displayed:
total 20
drwxr-xr-x 2 root root 4096 Oct 30 07:53 .
drwxr-xr-x 3 root root 4096 Oct 30 06:51 ..
-rw-r--r-- 1 root root 10703 Oct 30 06:51 index.html
By default, the system has a web page file named index.html in the /var/www/html directory, owned by the root user. Since regular users cannot directly modify files owned by root, if you need to edit this web page, you must change its owner to your own username.
Default user q:
sudo chown q:q index.html
Other custom user:
sudo chown <username>:<username> index.html
Now you can edit this file. After modification, simply refresh the browser to view the changes to the web page.
Troubleshooting¶
Symptom |
Possible Cause |
Solution |
|---|---|---|
Windows Command Prompt reports |
|
Open Windows PowerShell and re-run |
|
Apache global |
Does not affect web page access; to eliminate the warning, set |
Can |
Apache service is not running, port 80 is not listening, or the device firewall has not allowed port 80 |
On the device, run |
|
The device’s current network cannot access Debian software repositories |
First confirm that the development board has internet access; if only LAN is available, download |
IP address is correct but still cannot access |
The device and Windows host are not on the same LAN, or the IP address changed after switching ADB/Ethernet |
Run |
If you confirm that Apache is listening on 0.0.0.0:80 but Windows still cannot access it, you can temporarily allow the Windows host to access port 80 (replace <Windows-host-IP> with the actual IP):
sudo iptables -I INPUT 1 -i eth0 -p tcp -s <Windows-host-IP> --dport 80 -j ACCEPT